package com.fg.pro.model.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fg.pro.model.config.ValidationGroups;
import com.fg.pro.model.entity.BaseEntity;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 部门(SysDept)表实体类
 *
 * @author makejava
 * @since 2025-07-17 10:10:47
 */
@SuppressWarnings("serial")
@Data
public class SysDept extends BaseEntity {
    //主键id
    private Long id;
    //部门名称
    @NotEmpty(message = "部门名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    @Size(message = "菜单名称字符长度大于2，小于20", max = 20, min = 2, groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private String deptName;
    //父id（自连接）
    private Long deptParentId;
    //部门等级（1-级，2-二级）
    @Max(message = "部门等级最低为3", value = 3, groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private Integer deptLev;
    //部门描述
    private String deptDes;

    @TableField(exist = false)
    private List<SysDept> children;


    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }
}

